import os

from celery import Celery
# celery -A celery_tasks.main worker -l info 启动celery
# 1.设置django环境
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'MeiDuo.settings')
# 2.创建celery对象
app = Celery("celery_tasks")
# 3.设置broker
app.config_from_object("celery_tasks.config")
# 4celery自动检测任务 这里会自动去celery_tasks.sms下找tasks.py
app.autodiscover_tasks(['celery_tasks.sms', 'celery_tasks.email'])
